Conversation
9b2c119 to
30f7fc8
Compare
30f7fc8 to
21e0efb
Compare
|
oooops - sorry, didn't realize you were working on this :) Feel free to force-push again, and I'll go clean my apartment instead, like I should be doing… |
…ercion Use Arrow DataType Display style as the north-star: terse, readable type names instead of dumping internal Rust enum structure. - `dyn LogicalType`: delegates to NativeType Display instead of Debug, e.g. `Int32` instead of `LogicalType(Native(Int32), Int32)` - `TypeSignatureClass`: shows just the class name, e.g. `Numeric` instead of `TypeSignatureClass::Numeric` - `Coercion`: shows just the desired type, e.g. `Float64` instead of `Coercion(TypeSignatureClass::...)` - `ImplicitCoercion`: uses Display for its fields instead of Debug This dramatically improves error messages like: Before: `round(Coercion(TypeSignatureClass::Native(LogicalType(Native(Float64), Float64)), implicit_coercion=ImplicitCoercion([Numeric], default_type=Float64), ...)` After: `round(Float64, Int64)` Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21e0efb to
aea6186
Compare
…n the snapshots, so just check the first part of the error message
timsaucer
left a comment
There was a problem hiding this comment.
Very nice cleanup! I'll leave it open for one more working day in case anyone else wants to chime in.
|
I'll try take a look at this tomorrow |
We've updated to arrow 57, which _finally_ implements [proper `Display` formatting for `DataType`](apache/arrow-rs#8290). arrow-rs formats things slightly differently from how we have, but I think we should just converge on one standard here, in arrow-rs, and [in datafusion](apache/datafusion#20605). ## How to review Only look at changes in `.rs` files by [clicking here](https://github.com/rerun-io/reality/pull/967/changes?file-filters%5B%5D=.rs). Then take a look at a few snapshots Source-Ref: 8587961f0f1089a9a0f22c7e6a1cf907af81d0e6
Jefffrey
left a comment
There was a problem hiding this comment.
I think this is a very good step forward; we should leave the original issue open though as there's still improvements to be made to the error messages, but this PR really helps in cutting down the ugliness
|
|
||
| # Error is returned from the physical plan. | ||
| query error Cannot cast Utf8\("1 DAY"\) to Int8 | ||
| query error Cannot cast 1 DAY to Int8 |
There was a problem hiding this comment.
I wonder if we can wrap the string literal here to make it more obvious its a string?
There was a problem hiding this comment.
The way I'd like to tackle that is by changing Display for ScalarValue to always include quotes for strings. But that will cause (another) cascade of snapshot updates. I would rather do that in a follow-up PR
Which issue does this PR close?
Rationale for this change
Error messages should be friendly, short, and readable.
What changes are included in this PR?
Displayfordyn LogicalType,TypeSignature,TypeSignatureClass, andCoercioninstead of falling back toDebug{:?}(Debug) to{}(Display)non-nullprefix for non-nullable fields inNativeTypeDisplay, following Arrow's conventionThe north star is to follow the convention set by arrow-rs
Are these changes tested?
New snapshot tests have been introduced, and existing ones updated.
Are there any user-facing changes?
Yes!
Before
After
Before
After